using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace CXDB{
    /// <summary>
    /// Strongly-typed collection for the VwCompanybase class.
    /// </summary>
    [Serializable]
    public partial class VwCompanybaseCollection : ReadOnlyList<VwCompanybase, VwCompanybaseCollection>
    {        
        public VwCompanybaseCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_companybase view.
    /// </summary>
    [Serializable]
    public partial class VwCompanybase : ReadOnlyRecord<VwCompanybase>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_companybase", TableType.View, DataService.GetInstance("CXDB"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarCompanyID = new TableSchema.TableColumn(schema);
                colvarCompanyID.ColumnName = "CompanyID";
                colvarCompanyID.DataType = DbType.AnsiStringFixedLength;
                colvarCompanyID.MaxLength = 100;
                colvarCompanyID.AutoIncrement = false;
                colvarCompanyID.IsNullable = false;
                colvarCompanyID.IsPrimaryKey = false;
                colvarCompanyID.IsForeignKey = false;
                colvarCompanyID.IsReadOnly = false;
                
                schema.Columns.Add(colvarCompanyID);
                
                TableSchema.TableColumn colvarCompanyName = new TableSchema.TableColumn(schema);
                colvarCompanyName.ColumnName = "CompanyName";
                colvarCompanyName.DataType = DbType.String;
                colvarCompanyName.MaxLength = 100;
                colvarCompanyName.AutoIncrement = false;
                colvarCompanyName.IsNullable = true;
                colvarCompanyName.IsPrimaryKey = false;
                colvarCompanyName.IsForeignKey = false;
                colvarCompanyName.IsReadOnly = false;
                
                schema.Columns.Add(colvarCompanyName);
                
                TableSchema.TableColumn colvarCompanyAddress = new TableSchema.TableColumn(schema);
                colvarCompanyAddress.ColumnName = "CompanyAddress";
                colvarCompanyAddress.DataType = DbType.String;
                colvarCompanyAddress.MaxLength = 250;
                colvarCompanyAddress.AutoIncrement = false;
                colvarCompanyAddress.IsNullable = true;
                colvarCompanyAddress.IsPrimaryKey = false;
                colvarCompanyAddress.IsForeignKey = false;
                colvarCompanyAddress.IsReadOnly = false;
                
                schema.Columns.Add(colvarCompanyAddress);
                
                TableSchema.TableColumn colvarTradeID = new TableSchema.TableColumn(schema);
                colvarTradeID.ColumnName = "TradeID";
                colvarTradeID.DataType = DbType.Int32;
                colvarTradeID.MaxLength = 0;
                colvarTradeID.AutoIncrement = false;
                colvarTradeID.IsNullable = true;
                colvarTradeID.IsPrimaryKey = false;
                colvarTradeID.IsForeignKey = false;
                colvarTradeID.IsReadOnly = false;
                
                schema.Columns.Add(colvarTradeID);
                
                TableSchema.TableColumn colvarElectricID = new TableSchema.TableColumn(schema);
                colvarElectricID.ColumnName = "ElectricID";
                colvarElectricID.DataType = DbType.Int32;
                colvarElectricID.MaxLength = 0;
                colvarElectricID.AutoIncrement = false;
                colvarElectricID.IsNullable = true;
                colvarElectricID.IsPrimaryKey = false;
                colvarElectricID.IsForeignKey = false;
                colvarElectricID.IsReadOnly = false;
                
                schema.Columns.Add(colvarElectricID);
                
                TableSchema.TableColumn colvarPersonCardID = new TableSchema.TableColumn(schema);
                colvarPersonCardID.ColumnName = "PersonCardID";
                colvarPersonCardID.DataType = DbType.String;
                colvarPersonCardID.MaxLength = 50;
                colvarPersonCardID.AutoIncrement = false;
                colvarPersonCardID.IsNullable = true;
                colvarPersonCardID.IsPrimaryKey = false;
                colvarPersonCardID.IsForeignKey = false;
                colvarPersonCardID.IsReadOnly = false;
                
                schema.Columns.Add(colvarPersonCardID);
                
                TableSchema.TableColumn colvarDepID = new TableSchema.TableColumn(schema);
                colvarDepID.ColumnName = "DepID";
                colvarDepID.DataType = DbType.Int32;
                colvarDepID.MaxLength = 0;
                colvarDepID.AutoIncrement = false;
                colvarDepID.IsNullable = true;
                colvarDepID.IsPrimaryKey = false;
                colvarDepID.IsForeignKey = false;
                colvarDepID.IsReadOnly = false;
                
                schema.Columns.Add(colvarDepID);
                
                TableSchema.TableColumn colvarScores = new TableSchema.TableColumn(schema);
                colvarScores.ColumnName = "Scores";
                colvarScores.DataType = DbType.Int32;
                colvarScores.MaxLength = 0;
                colvarScores.AutoIncrement = false;
                colvarScores.IsNullable = true;
                colvarScores.IsPrimaryKey = false;
                colvarScores.IsForeignKey = false;
                colvarScores.IsReadOnly = false;
                
                schema.Columns.Add(colvarScores);
                
                TableSchema.TableColumn colvarCredit = new TableSchema.TableColumn(schema);
                colvarCredit.ColumnName = "Credit";
                colvarCredit.DataType = DbType.String;
                colvarCredit.MaxLength = 50;
                colvarCredit.AutoIncrement = false;
                colvarCredit.IsNullable = true;
                colvarCredit.IsPrimaryKey = false;
                colvarCredit.IsForeignKey = false;
                colvarCredit.IsReadOnly = false;
                
                schema.Columns.Add(colvarCredit);
                
                TableSchema.TableColumn colvarStatus = new TableSchema.TableColumn(schema);
                colvarStatus.ColumnName = "Status";
                colvarStatus.DataType = DbType.String;
                colvarStatus.MaxLength = 50;
                colvarStatus.AutoIncrement = false;
                colvarStatus.IsNullable = true;
                colvarStatus.IsPrimaryKey = false;
                colvarStatus.IsForeignKey = false;
                colvarStatus.IsReadOnly = false;
                
                schema.Columns.Add(colvarStatus);
                
                TableSchema.TableColumn colvarEnteringID = new TableSchema.TableColumn(schema);
                colvarEnteringID.ColumnName = "EnteringID";
                colvarEnteringID.DataType = DbType.Int32;
                colvarEnteringID.MaxLength = 0;
                colvarEnteringID.AutoIncrement = false;
                colvarEnteringID.IsNullable = true;
                colvarEnteringID.IsPrimaryKey = false;
                colvarEnteringID.IsForeignKey = false;
                colvarEnteringID.IsReadOnly = false;
                
                schema.Columns.Add(colvarEnteringID);
                
                TableSchema.TableColumn colvarVerifierID = new TableSchema.TableColumn(schema);
                colvarVerifierID.ColumnName = "VerifierID";
                colvarVerifierID.DataType = DbType.Int32;
                colvarVerifierID.MaxLength = 0;
                colvarVerifierID.AutoIncrement = false;
                colvarVerifierID.IsNullable = true;
                colvarVerifierID.IsPrimaryKey = false;
                colvarVerifierID.IsForeignKey = false;
                colvarVerifierID.IsReadOnly = false;
                
                schema.Columns.Add(colvarVerifierID);
                
                TableSchema.TableColumn colvarInTime = new TableSchema.TableColumn(schema);
                colvarInTime.ColumnName = "inTime";
                colvarInTime.DataType = DbType.DateTime;
                colvarInTime.MaxLength = 0;
                colvarInTime.AutoIncrement = false;
                colvarInTime.IsNullable = true;
                colvarInTime.IsPrimaryKey = false;
                colvarInTime.IsForeignKey = false;
                colvarInTime.IsReadOnly = false;
                
                schema.Columns.Add(colvarInTime);
                
                TableSchema.TableColumn colvarGuid = new TableSchema.TableColumn(schema);
                colvarGuid.ColumnName = "Guid";
                colvarGuid.DataType = DbType.Guid;
                colvarGuid.MaxLength = 0;
                colvarGuid.AutoIncrement = false;
                colvarGuid.IsNullable = true;
                colvarGuid.IsPrimaryKey = false;
                colvarGuid.IsForeignKey = false;
                colvarGuid.IsReadOnly = false;
                
                schema.Columns.Add(colvarGuid);
                
                TableSchema.TableColumn colvarElectricName = new TableSchema.TableColumn(schema);
                colvarElectricName.ColumnName = "ElectricName";
                colvarElectricName.DataType = DbType.String;
                colvarElectricName.MaxLength = 100;
                colvarElectricName.AutoIncrement = false;
                colvarElectricName.IsNullable = true;
                colvarElectricName.IsPrimaryKey = false;
                colvarElectricName.IsForeignKey = false;
                colvarElectricName.IsReadOnly = false;
                
                schema.Columns.Add(colvarElectricName);
                
                TableSchema.TableColumn colvarTradeName = new TableSchema.TableColumn(schema);
                colvarTradeName.ColumnName = "TradeName";
                colvarTradeName.DataType = DbType.String;
                colvarTradeName.MaxLength = 100;
                colvarTradeName.AutoIncrement = false;
                colvarTradeName.IsNullable = true;
                colvarTradeName.IsPrimaryKey = false;
                colvarTradeName.IsForeignKey = false;
                colvarTradeName.IsReadOnly = false;
                
                schema.Columns.Add(colvarTradeName);
                
                TableSchema.TableColumn colvarDeptName = new TableSchema.TableColumn(schema);
                colvarDeptName.ColumnName = "DeptName";
                colvarDeptName.DataType = DbType.String;
                colvarDeptName.MaxLength = 50;
                colvarDeptName.AutoIncrement = false;
                colvarDeptName.IsNullable = true;
                colvarDeptName.IsPrimaryKey = false;
                colvarDeptName.IsForeignKey = false;
                colvarDeptName.IsReadOnly = false;
                
                schema.Columns.Add(colvarDeptName);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["CXDB"].AddSchema("vw_companybase",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public VwCompanybase()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public VwCompanybase(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public VwCompanybase(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public VwCompanybase(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("CompanyID")]
        [Bindable(true)]
        public string CompanyID 
	    {
		    get
		    {
			    return GetColumnValue<string>("CompanyID");
		    }
            set 
		    {
			    SetColumnValue("CompanyID", value);
            }
        }
	      
        [XmlAttribute("CompanyName")]
        [Bindable(true)]
        public string CompanyName 
	    {
		    get
		    {
			    return GetColumnValue<string>("CompanyName");
		    }
            set 
		    {
			    SetColumnValue("CompanyName", value);
            }
        }
	      
        [XmlAttribute("CompanyAddress")]
        [Bindable(true)]
        public string CompanyAddress 
	    {
		    get
		    {
			    return GetColumnValue<string>("CompanyAddress");
		    }
            set 
		    {
			    SetColumnValue("CompanyAddress", value);
            }
        }
	      
        [XmlAttribute("TradeID")]
        [Bindable(true)]
        public int? TradeID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("TradeID");
		    }
            set 
		    {
			    SetColumnValue("TradeID", value);
            }
        }
	      
        [XmlAttribute("ElectricID")]
        [Bindable(true)]
        public int? ElectricID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ElectricID");
		    }
            set 
		    {
			    SetColumnValue("ElectricID", value);
            }
        }
	      
        [XmlAttribute("PersonCardID")]
        [Bindable(true)]
        public string PersonCardID 
	    {
		    get
		    {
			    return GetColumnValue<string>("PersonCardID");
		    }
            set 
		    {
			    SetColumnValue("PersonCardID", value);
            }
        }
	      
        [XmlAttribute("DepID")]
        [Bindable(true)]
        public int? DepID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("DepID");
		    }
            set 
		    {
			    SetColumnValue("DepID", value);
            }
        }
	      
        [XmlAttribute("Scores")]
        [Bindable(true)]
        public int? Scores 
	    {
		    get
		    {
			    return GetColumnValue<int?>("Scores");
		    }
            set 
		    {
			    SetColumnValue("Scores", value);
            }
        }
	      
        [XmlAttribute("Credit")]
        [Bindable(true)]
        public string Credit 
	    {
		    get
		    {
			    return GetColumnValue<string>("Credit");
		    }
            set 
		    {
			    SetColumnValue("Credit", value);
            }
        }
	      
        [XmlAttribute("Status")]
        [Bindable(true)]
        public string Status 
	    {
		    get
		    {
			    return GetColumnValue<string>("Status");
		    }
            set 
		    {
			    SetColumnValue("Status", value);
            }
        }
	      
        [XmlAttribute("EnteringID")]
        [Bindable(true)]
        public int? EnteringID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("EnteringID");
		    }
            set 
		    {
			    SetColumnValue("EnteringID", value);
            }
        }
	      
        [XmlAttribute("VerifierID")]
        [Bindable(true)]
        public int? VerifierID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("VerifierID");
		    }
            set 
		    {
			    SetColumnValue("VerifierID", value);
            }
        }
	      
        [XmlAttribute("InTime")]
        [Bindable(true)]
        public DateTime? InTime 
	    {
		    get
		    {
			    return GetColumnValue<DateTime?>("inTime");
		    }
            set 
		    {
			    SetColumnValue("inTime", value);
            }
        }
	      
        [XmlAttribute("Guid")]
        [Bindable(true)]
        public Guid? Guid 
	    {
		    get
		    {
			    return GetColumnValue<Guid?>("Guid");
		    }
            set 
		    {
			    SetColumnValue("Guid", value);
            }
        }
	      
        [XmlAttribute("ElectricName")]
        [Bindable(true)]
        public string ElectricName 
	    {
		    get
		    {
			    return GetColumnValue<string>("ElectricName");
		    }
            set 
		    {
			    SetColumnValue("ElectricName", value);
            }
        }
	      
        [XmlAttribute("TradeName")]
        [Bindable(true)]
        public string TradeName 
	    {
		    get
		    {
			    return GetColumnValue<string>("TradeName");
		    }
            set 
		    {
			    SetColumnValue("TradeName", value);
            }
        }
	      
        [XmlAttribute("DeptName")]
        [Bindable(true)]
        public string DeptName 
	    {
		    get
		    {
			    return GetColumnValue<string>("DeptName");
		    }
            set 
		    {
			    SetColumnValue("DeptName", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string CompanyID = @"CompanyID";
            
            public static string CompanyName = @"CompanyName";
            
            public static string CompanyAddress = @"CompanyAddress";
            
            public static string TradeID = @"TradeID";
            
            public static string ElectricID = @"ElectricID";
            
            public static string PersonCardID = @"PersonCardID";
            
            public static string DepID = @"DepID";
            
            public static string Scores = @"Scores";
            
            public static string Credit = @"Credit";
            
            public static string Status = @"Status";
            
            public static string EnteringID = @"EnteringID";
            
            public static string VerifierID = @"VerifierID";
            
            public static string InTime = @"inTime";
            
            public static string Guid = @"Guid";
            
            public static string ElectricName = @"ElectricName";
            
            public static string TradeName = @"TradeName";
            
            public static string DeptName = @"DeptName";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
